package com.example.myspringboot.business.schedule;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;

/**
 * 通过配置类配置定时任务线程池
 *
 * @author nagiumi
 * @date 2023/11/23
 */
@Configuration
public class ScheduleConfig {

    @Bean
    public ThreadPoolTaskScheduler configScheduler() {
        ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler();
        scheduler.setPoolSize(2);
        scheduler.setThreadNamePrefix("nagiumi-config-scheduler-");
        return scheduler;
    }
}
